package com.sirenbang.easyshop.service.impl;

import java.util.List;

import com.sirenbang.easyshop.dao.ManagerDao;
import com.sirenbang.easyshop.dao.impl.ManagerDaoXMLImpl;
import com.sirenbang.easyshop.domain.Manager;
import com.sirenbang.easyshop.service.ManagerService;
import com.sirenbang.easyshop.utils.ManagerSearchHelper;
import com.sirenbang.easyshop.utils.Page;


public class ManagerServiceImpl implements ManagerService {

	public void add(Manager manager) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		dao.add(manager);

	}

	public void delete(String managerName) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		dao.deleteByName(managerName);
		
	}

	public void mend(Manager manager) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		dao.update(manager);
		
	}

	public Manager searchByName(String managerName) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		return dao.getByName(managerName);
		
	}

	public List<Manager> loadAll() {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		return dao.loadAll();
		
	}

	public long countByHelper(ManagerSearchHelper managerSearchHelper) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		return dao.countByHelper(managerSearchHelper);
		
	}

	public Page loadScopeManager(ManagerSearchHelper managerSearchHelper, Page page) {
		
		ManagerDao dao=new ManagerDaoXMLImpl();
		page.setPageContent(dao.loadScopeManager(managerSearchHelper, page.getStartIndex(), page.getEndIndex()));
		return page;
		
	}
	
	

}
